package ysq.xyg.controller;

import com.github.pagehelper.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import ysq.xyg.model.Member;
import ysq.xyg.service.ActivityService;
import ysq.xyg.service.ItemService;
import ysq.xyg.service.MemberService;
import ysq.xyg.service.WinNumService;
import ysq.xyg.util.ProProperties;

import javax.annotation.Resource;

/**
 * 手机端数据
 *
 * @author congcong tao
 * @date 2018/8/15 15:22
 */
@Controller
@RequestMapping("/mobile")
public class MobileController extends BaseController {

    private static Logger log= LoggerFactory.getLogger(MobileController.class);
    @Resource
    private ActivityService activityService;
    @Resource
    private WinNumService winNumService;
    @Resource
    private ItemService itemService;
    @Resource
    private MemberService memberService;

    private ModelAndView checkModelAndView;

    /**
     * 通用验证
     * */
    protected  boolean check(String id, String state){
        if(StringUtil.isNotEmpty(id)){
            Member member=memberService.selectByPrimaryKey(id);
            if(member!=null){
                return true;
            }
        }
        checkModelAndView=new ModelAndView("redirect:"+ ProProperties.getInstance().getWxOauthURL(state));
        return false;
    }
}
